package com.ranga.mselfcare;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class MainMenuActivity extends Activity implements OnClickListener {

	private ImageButton iBtnServices, iBtnTopUp, iBtnUsage, iBtnTopUpFriend,
		iBtnBalance, iBtnEPocket, iBtnSettings, iBtnTransactions;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main_menu);
		
		iBtnServices = (ImageButton) findViewById(R.id.ib_services);
		iBtnTopUp = (ImageButton) findViewById(R.id.ib_topUp);
		iBtnUsage = (ImageButton) findViewById(R.id.ib_usage);
		iBtnTopUpFriend = (ImageButton) findViewById(R.id.ib_topUpFriend);
		iBtnBalance = (ImageButton) findViewById(R.id.ib_balance);
		iBtnEPocket = (ImageButton) findViewById(R.id.ib_ePocket);
		iBtnSettings = (ImageButton) findViewById(R.id.ib_settings);
		iBtnTransactions = (ImageButton) findViewById(R.id.ib_transactions);
		
		iBtnServices.setOnClickListener(this);
		iBtnTopUp.setOnClickListener(this);
		iBtnUsage.setOnClickListener(this);
		iBtnTopUpFriend.setOnClickListener(this);
		iBtnBalance.setOnClickListener(this);
		iBtnEPocket.setOnClickListener(this);
		iBtnSettings.setOnClickListener(this);
		iBtnTransactions.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.ib_services:
			break;
		case R.id.ib_topUp:
			Intent intentTopUp = new Intent(MainMenuActivity.this, TopUpSelfActivity.class);
			finish();
			startActivity(intentTopUp);
			break;
		case R.id.ib_usage:
			break;
		case R.id.ib_topUpFriend:
			break;
		case R.id.ib_balance:
			Intent intentBalance = new Intent(MainMenuActivity.this, BalanceActivity.class);
			finish();
			startActivity(intentBalance);
			break;
		case R.id.ib_ePocket:
			break;
		case R.id.ib_settings:
			break;
		case R.id.ib_transactions:
			Intent intentTransactions = new Intent(MainMenuActivity.this, TransactionActivity.class);
			finish();
			startActivity(intentTransactions);
			break;

		}
		
	}
	
	@Override
	public void onBackPressed() {
		AlertDialog.Builder alertExit = new AlertDialog.Builder(this);
		alertExit.setTitle(getString(R.string.alert));
		alertExit.setMessage(getString(R.string.alert_exit));
		alertExit.setPositiveButton(getString(R.string.yes),
				new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {
						finish();

					}
				});
		alertExit.setNegativeButton(getString(R.string.no),
				new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {
						dialog.dismiss();

					}
				});
		alertExit.show();
	}

}
